/*
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 */
using VOL.Core.BaseProvider;
using VOL.Core.Utilities;
using VOL.Entity.DomainModels;

namespace VOL.demo.IServices
{
    public partial interface IInventoryCountService : IService<InventoryCount>
    {
        /// <summary>
        /// 分页查询盘点单
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="countCode">盘点单号</param>
        /// <param name="countType">盘点类型（如“存货盘点”）</param>
        /// <param name="warehouseId">仓库ID</param>
        /// <param name="countStatus">盘点状态（无盈亏/有盈亏）</param>
        /// <param name="startTime">盘点开始时间（范围查询起始）</param>
        /// <param name="endTime">盘点结束时间（范围查询结束）</param>
        /// <param name="creatorId">制单人ID</param>
        /// <returns>分页结果（包含盘点单列表及分页信息）</returns>
        Task<WebResponseContent> GetInventoryCountPageListAsync(
            int pageIndex,
            int pageSize,
            string countCode = null,
            string countType = null,
            int? warehouseId = null,
            string countStatus = null,
            DateTime? startTime = null,
            DateTime? endTime = null,
            int? creatorId = null);

        /// <summary>
        /// 保存盘点单（创建或更新）
        /// </summary>
        /// <param name="request">盘点单保存请求（包含主表和明细）</param>
        /// <returns>保存结果（成功/失败状态、消息等）</returns>
        Task<WebResponseContent> SaveInventoryCountAsync(SaveInventoryCountRequest request);
    }
    /// <summary>
    /// 保存盘点单请求模型
    /// </summary>
    public class SaveInventoryCountRequest
    {
        /// <summary>
        /// 盘点单主表信息
        /// </summary>
        public InventoryCountCreateDto InventoryCount { get; set; }

        /// <summary>
        /// 盘点单明细项列表
        /// </summary>
        public List<InventoryCountItemCreateDto> CountItems { get; set; }
    }

    /// <summary>
    /// 盘点单创建DTO（不含自增主键）
    /// </summary>
    public class InventoryCountCreateDto
    {
        /// <summary>
        /// 盘点单号
        /// </summary>
        public string CountCode { get; set; }

        /// <summary>
        /// 盘点类型（如“存货盘点”）
        /// </summary>
        public string CountType { get; set; }

        /// <summary>
        /// 盘点开始时间
        /// </summary>
        public DateTime? StartTime { get; set; }

        /// <summary>
        /// 盘点结束时间
        /// </summary>
        public DateTime? EndTime { get; set; }

        /// <summary>
        /// 外键：关联仓库表主键
        /// </summary>
        public int? WarehouseId { get; set; }

        /// <summary>
        /// 外键：关联制单人用户表主键
        /// </summary>
        public int? CreatorId { get; set; }

        /// <summary>
        /// 外键：关联经办人用户表主键
        /// </summary>
        public int? HandlerId { get; set; }

        /// <summary>
        /// 所在部门
        /// </summary>
        public string Department { get; set; }

        /// <summary>
        /// 制单时间（通常由服务端自动生成，客户端可省略）
        /// </summary>
        public DateTime? CreateTime { get; set; }

        /// <summary>
        /// 盘点状态（无盈亏/有盈亏）
        /// </summary>
        public string CountStatus { get; set; }

        /// <summary>
        /// 出库状态（未出库/部分出库/已出库）
        /// </summary>
        public string OutStatus { get; set; }

        /// <summary>
        /// 入库状态（未入库/部分入库/已入库）
        /// </summary>
        public string InStatus { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
    }

    /// <summary>
    /// 盘点明细项创建DTO（不含自增主键）
    /// </summary>
    public class InventoryCountItemCreateDto
    {
        /// <summary>
        /// 外键：关联盘点单的盘点单号
        /// </summary>
        public string CountCode { get; set; }

        /// <summary>
        /// 外键：关联商品表主键
        /// </summary>
        public int? ProductId { get; set; }

        /// <summary>
        /// 商品编号
        /// </summary>
        public string ProductCode { get; set; }

        /// <summary>
        /// 商品名称
        /// </summary>
        public string ProductName { get; set; }

        /// <summary>
        /// 规格型号
        /// </summary>
        public string Spec { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        public string Unit { get; set; }

        /// <summary>
        /// 账面库存数量
        /// </summary>
        public decimal BookStock { get; set; }

        /// <summary>
        /// 账面库存金额
        /// </summary>
        public decimal BookAmount { get; set; }

        /// <summary>
        /// 盘点库位
        /// </summary>
        public string CountLocation { get; set; }

        /// <summary>
        /// 实际盘点数量
        /// </summary>
        public decimal CountQuantity { get; set; }

        /// <summary>
        /// 盈亏数量（通常=实际盘点数量-账面库存数量，可由服务端计算）
        /// </summary>
        public decimal ProfitLossQuantity { get; set; }

        /// <summary>
        /// 盈亏金额（通常=盈亏数量×参考单价，可由服务端计算）
        /// </summary>
        public decimal ProfitLossAmount { get; set; }

        /// <summary>
        /// 参考单价
        /// </summary>
        public decimal ReferencePrice { get; set; }

        /// <summary>
        /// 盘点状态（盘盈/盘亏/无盈亏）
        /// </summary>
        public string CountStatus { get; set; }

        /// <summary>
        /// 出入库状态
        /// </summary>
        public string InOutStatus { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
    }
}
